<?php
	/**
	* 
	*/
	use PHPMailer\PHPMailer;
	require_once 'PHPMailer.PHP';	
	require_once 'SMTP.PHP';

	class sendEmail
	{
		public $mail = '';
		public static $CharSet = 'utf-8';
		public static $SMTPSecure = 'ssl';
		public static $Port = 994;
		public static $Host = 'smtp.163.com';
		public static $sendAdrs = 'gaoking1991@163.com';
		public static $sendName = 'Gmanner';
		public static $getAdrs = '407429685@qq.com';
		public static $getName = 'NIVE';
		private static $userName = 'gaoking1991';
		private static $Psword = 'gaoking123??';
		public function __construct()
		{
			$this->mail = new PHPMailer\PHPMailer();
		}

		public function loadConfig(){

			$this->mail->isSMTP();
			$this->mail->CharSet = self::$CharSet;
			$this->mail->Host = self::$Host;
			$this->mail->SMTPAuth = true;
			$this->mail->Username = self::$userName;
			$this->mail->Password = self::$Psword;
			$this->mail->SMTPSecure = self::$SMTPSecure;
			$this->mail->Port = self::$Port;
			$this->mail->setFrom(self::$sendAdrs,self::$sendName);
			$this->mail->addReplyTo(self::$sendAdrs,'replay');
			$this->mail->isHTML(true);

		}

		public function addFile($path){
			$this->mail->addAttachment($path);
		}

		public function sendMail($getAdrs,$title,$content){
			$this->loadConfig();
			$this->mail->addAddress($getAdrs,'test');
			$this->mail->Subject = $title;
			$this->mail->Body = $content;
			if(!$this->mail->send()){
				return '-1';
				//return '<br/>'.$this->mail->ErrorInfo;
			}else{
				return "1";
			}
		}
	}

